// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 26.1.11
description: >
  Returns target's own non enumerable property keys.
info: |
  26.1.11 Reflect.ownKeys ( target )

  ...
  2. Let keys be target.[[OwnPropertyKeys]]().
  3. ReturnIfAbrupt(keys).
  4. Return CreateArrayFromList(keys).
includes: [compareArray.js]
features: [Reflect]
---*/

function Test() {
    assert.compareArray(
      Reflect.ownKeys([]),
      ['length'],
      'return non enumerable `length` from empty array'
    );

    assert.compareArray(Reflect.ownKeys([, , 2]), ['2', 'length'], 'return array keys');

    var o = {};
    Object.defineProperty(o, 'p1', {
      value: 42,
      enumerable: false
    });
    Object.defineProperty(o, 'p2', {
      get: function() {},
      enumerable: false
    });

    assert.compareArray(Reflect.ownKeys(o), ['p1', 'p2']);
}

// preheat
const NUMBER_OF_PREHEAT = 1;
for (let i = 0; i < NUMBER_OF_PREHEAT; i++) {
    Test();
}

ArkTools.jitCompileAsync(Test);
assert.sameValue(ArkTools.waitJitCompileFinish(Test), true, '[JIT] JIT disabled.');

// test
const NUMBER_OF_TEST = 1; // or 2
for (let i = 0; i < NUMBER_OF_PREHEAT; i++) {
    Test();
}
